package com.sdry.service.impl.lz;
import com.sdry.mapper.lz.DeviceMapper;
import com.sdry.model.llm.Department;
import com.sdry.model.lz.DeviceModel;
import com.sdry.model.lz.LzQueryCriteria;
import com.sdry.service.lz.DeviceService;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

import java.util.List;

/**
 * @ClassName DeviceServiceImpl
 * @Description 设备信息
 * @Author lz
 * @Date 2018年9月18日 11:50:52
 * @Version 1.0
 */
@Service
@Transactional
public class DeviceServiceImpl implements DeviceService {
    @Resource
    DeviceMapper deviceMapper;

    /**
     * 分页条件查询集合
     * @param criteria 分页条件
     * @return DeviceModel
     */
    @Override
    public List<DeviceModel> queryDeviceInfo(LzQueryCriteria criteria) {
        return deviceMapper.queryDeviceInfo(criteria);
    }

    /**
     * 分页条件查询条数
     * @param criteria 分页条件
     * @return 条数
     */
    @Override
    public int countDeviceInfo(LzQueryCriteria criteria) {
        return deviceMapper.countDeviceInfo(criteria);
    }

    /**
     * 单个删除和批量删除
     * @param id 选中的ID
     * @return 影响行数
     */
    @Override
    public Long deleteDeviceById(long id) {
        return deviceMapper.deleteDeviceById(id);
    }

    /**
     * 新增设备信息
     * @param deviceModel 设备实体
     * @return
     */
    @Override
    public Long addDeviceInfo(DeviceModel deviceModel) {
        return deviceMapper.addDeviceInfo(deviceModel);
    }

    /**
     * 根据ID修改设备信息
     * @param deviceModel 编辑行的数据ID
     * @return 影响行数
     */
    @Override
    public Long editDeviceInfoById(DeviceModel deviceModel) {
        return deviceMapper.editDeviceInfoById(deviceModel);
    }
    /**
     * 下拉框查找左右设备
     * @return
     */
	@Override
	public List<DeviceModel> queryAllDeviceList() {
		return deviceMapper.queryAllDeviceList();
	}

	/**
	 * 下拉框查找所有部门
	 */
	@Override
	public List<Department> queryAllDeptList() {
		return deviceMapper.queryAllDeptList();
	}

	/**
	 * 根据ID查找设备信息
     * @throws Exception 
	 */
	@Override
	public List<DeviceModel> queryDeviceInfoByNo(String deviceNo) {
		return deviceMapper.queryDeviceInfoByNo(deviceNo);
	}
}
